# -*- coding:utf-8 -*-

import requests


class Crawler:
    """
    爬取数据的方法
    """

    def __init__(self, get_url, headers):
        self.get_url = get_url
        self.headers = headers

    def get(self, data=None):
        if data is None:
            return requests.get(self.get_url, headers=self.headers)
        else:
            return requests.get(self.get_url, params=data, headers=self.headers)

    def post(self, data=None):
        if data is None:
            return requests.post(self.get_url, headers=self.headers)
        else:
            return requests.post(self.get_url, data=data, headers=self.headers)
